<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RabbitMQ 核心组件深度解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* 首字下沉效果 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #4f46e5;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 卡片悬停效果 */
        .component-card {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
        }
        
        .component-card:hover {
            transform: translateY(-8px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
        }
        
        /* 渐变标题 */
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .fade-in-up {
            animation: fadeInUp 0.8s ease-out forwards;
        }
        
        /* 自定义滚动条 */
        ::-webkit-scrollbar {
            width: 10px;
        }
        
        ::-webkit-scrollbar-track {
            background: #f1f1f1;
        }
        
        ::-webkit-scrollbar-thumb {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 5px;
        }
        
        /* 代码样式 */
        .code-inline {
            background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
            padding: 0.2rem 0.5rem;
            border-radius: 0.375rem;
            font-family: 'Courier New', monospace;
            font-size: 0.9em;
            color: #4f46e5;
            border: 1px solid #e5e7eb;
        }
        
        /* 列表样式 */
        .custom-list li {
            position: relative;
            padding-left: 2rem;
            margin-bottom: 1rem;
        }
        
        .custom-list li::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0.5rem;
            width: 0.5rem;
            height: 0.5rem;
            background: #4f46e5;
            border-radius: 50%;
        }
        
        /* Mermaid 图表样式 */
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero 区域 -->
    <section class="relative overflow-hidden">
        <div class="absolute inset-0 bg-gradient-to-br from-purple-600 via-indigo-600 to-blue-600 opacity-90"></div>
        <div class="relative container mx-auto px-6 py-24 text-center">
            <h1 class="text-5xl md:text-7xl font-bold text-white mb-6 fade-in-up">
                RabbitMQ <span class="block text-3xl md:text-5xl mt-4 font-light">核心组件深度解析</span>
            </h1>
            <p class="text-xl md:text-2xl text-gray-100 max-w-3xl mx-auto fade-in-up" style="animation-delay: 0.2s;">
                <i class="fas fa-quote-left text-3xl opacity-50 mr-2"></i>
                深入理解消息队列的灵魂架构，掌握高性能分布式系统的核心密码
                <i class="fas fa-quote-right text-3xl opacity-50 ml-2"></i>
            </p>
            <div class="mt-12 flex justify-center space-x-8 fade-in-up" style="animation-delay: 0.4s;">
                <div class="text-center">
                    <i class="fas fa-server text-4xl text-white mb-2"></i>
                    <p class="text-white font-semibold">9大核心组件</p>
                </div>
                <div class="text-center">
                    <i class="fas fa-network-wired text-4xl text-white mb-2"></i>
                    <p class="text-white font-semibold">完整架构体系</p>
                </div>
                <div class="text-center">
                    <i class="fas fa-rocket text-4xl text-white mb-2"></i>
                    <p class="text-white font-semibold">高性能保障</p>
                </div>
            </div>
        </div>
    </section>

    <!-- 引言部分 -->
    <section class="container mx-auto px-6 py-16">
        <div class="max-w-4xl mx-auto">
            <div class="bg-white rounded-2xl shadow-xl p-10 fade-in-up">
                <p class="text-lg leading-relaxed text-gray-700 drop-cap">
                    在 RabbitMQ 中，多个核心组件相互配合，以实现消息的生产、路由、队列管理和消费。理解这些组件及其功能对掌握 RabbitMQ 的使用和优化至关重要。每一个组件都扮演着独特而关键的角色，共同构建了一个强大、灵活且可靠的消息传递系统。
                </p>
            </div>
        </div>
    </section>

    <!-- 架构可视化 -->
    <section class="container mx-auto px-6 py-8">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 gradient-text">RabbitMQ 架构全景图</h2>
            <div class="bg-white rounded-2xl shadow-xl p-8">
                <div class="mermaid">
                    graph TB
                        subgraph "生产端"
                            P[<i class='fas fa-industry'></i> Producer<br/>生产者]
                        end
                        
                        subgraph "RabbitMQ Broker"
                            subgraph "Virtual Host"
                                E1[<i class='fas fa-exchange-alt'></i> Direct Exchange]
                                E2[<i class='fas fa-broadcast-tower'></i> Fanout Exchange]
                                E3[<i class='fas fa-filter'></i> Topic Exchange]
                                E4[<i class='fas fa-tags'></i> Headers Exchange]
                                
                                Q1[<i class='fas fa-inbox'></i> Queue 1]
                                Q2[<i class='fas fa-inbox'></i> Queue 2]
                                Q3[<i class='fas fa-inbox'></i> Queue 3]
                                
                                B1[<i class='fas fa-link'></i> Binding]
                                B2[<i class='fas fa-link'></i> Binding]
                                B3[<i class='fas fa-link'></i> Binding]
                            end
                            
                            CH[<i class='fas fa-plug'></i> Connection/Channel]
                        end
                        
                        subgraph "消费端"
                            C1[<i class='fas fa-user'></i> Consumer 1]
                            C2[<i class='fas fa-user'></i> Consumer 2]
                            C3[<i class='fas fa-user'></i> Consumer 3]
                        end
                        
                        P -->|发送消息| CH
                        CH --> E1
                        CH --> E2
                        CH --> E3
                        CH --> E4
                        
                        E1 -.->|路由键匹配| B1
                        E2 -.->|广播| B2
                        E3 -.->|模式匹配| B3
                        
                        B1 --> Q1
                        B2 --> Q2
                        B3 --> Q3
                        
                        Q1 -->|消费| C1
                        Q2 -->|消费| C2
                        Q3 -->|消费| C3
                        
                        style P fill:#e0e7ff,stroke:#6366f1
                        style E1 fill:#fef3c7,stroke:#f59e0b
                        style E2 fill:#fef3c7,stroke:#f59e0b
                        style E3 fill:#fef3c7,stroke:#f59e0b
                        style E4 fill:#fef3c7,stroke:#f59e0b
                        style Q1 fill:#d1fae5,stroke:#10b981
                        style Q2 fill:#d1fae5,stroke:#10b981
                        style Q3 fill:#d1fae5,stroke:#10b981
                        style C1 fill:#fce7f3,stroke:#ec4899
                        style C2 fill:#fce7f3,stroke:#ec4899
                        style C3 fill:#fce7f3,stroke:#ec4899
                </div>
            </div>
        </div>
    </section>

    <!-- 核心组件详解 -->
    <section class="container mx-auto px-6 py-16">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-4xl font-bold text-center mb-16 gradient-text">核心组件深度剖析</h2>
            
            <!-- Broker -->
            <div class="component-card rounded-2xl shadow-lg p-8 mb-8 fade-in-up">
                <div class="flex items-center mb-6">
                    <div class="w-16 h-16 bg-gradient-to-br from-purple-500 to-indigo-600 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-server text-white text-2xl"></i>
                    </div>
                    <h3 class="text-3xl font-bold text-gray-800">1. Broker（代理）</h3>
                </div>
                <p class="text-lg text-gray-700 mb-6">
                    <strong class="text-indigo-600">Broker 是 RabbitMQ 的核心部分</strong>，负责接收、存储和转发消息。
                </p>
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="bg-gradient-to-br from-purple-50 to-indigo-50 p-6 rounded-xl">
                        <i class="fas fa-route text-3xl text-indigo-600 mb-3"></i>
                        <h4 class="font-bold text-lg mb-2">消息路由</h4>
                        <p class="text-gray-600">根据绑定关系和路由规则将消息从生产者转发到合适的队列。</p>
                    </div>
                    <div class="bg-gradient-to-br from-purple-50 to-indigo-50 p-6 rounded-xl">
                        <i class="fas fa-database text-3xl text-indigo-600 mb-3"></i>
                        <h4 class="font-bold text-lg mb-2">消息存储</h4>
                        <p class="text-gray-600">提供消息持久化的能力，确保在 RabbitMQ 服务重启后，消息不会丢失。</p>
                    </div>
                    <div class="bg-gradient-to-br from-purple-50 to-indigo-50 p-6 rounded-xl">
                        <i class="fas fa-sort-amount-up text-3xl text-indigo-600 mb-3"></i>
                        <h4 class="font-bold text-lg mb-2">优先级管理</h4>
                        <p class="text-gray-600">支持为消息设置优先级，以便按需进行消息处理。</p>
                    </div>
                </div>
            </div>

            <!-- Producer -->
            <div class="component-card rounded-2xl shadow-lg p-8 mb-8 fade-in-up">
                <div class="flex items-center mb-6">
                    <div class="w-16 h-16 bg-gradient-to-br from-blue-500 to-cyan-600 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-industry text-white text-2xl"></i>
                    </div>
                    <h3 class="text-3xl font-bold text-gray-800">2. Producer（生产者）</h3>
                </div>
                <p class="text-lg text-gray-700 mb-6">
                    <strong class="text-blue-600">生产者是消息的发送端</strong>，负责将消息发送到 RabbitMQ Broker 中的交换机。
                </p>
                <div class="bg-gradient-to-r from-blue-50 to-cyan-50 p-6 rounded-xl mb-4">
                    <h4 class="font-bold text-xl mb-4 text-gray-800">
                        <i class="fas fa-cogs text-blue-600 mr-2"></i>核心功能
                    